home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / STC9 / Math / CLineIntersection.as
Text File  |  2011-08-19  |  3KB  |  97 lines

  1. package STC9.Math
  2. {
  3.    import flash.geom.Point;
  4.    
  5.    public class CLineIntersection
  6.    {
  7.       
  8.       private static var nPrecision:Number = 0.000001;
  9.        
  10.       
  11.       public function CLineIntersection()
  12.       {
  13.          super();
  14.       }
  15.       
  16.       public static function InfinatePD(param1:Point, param2:Point, param3:Point, param4:Point) : Point
  17.       {
  18.          var _loc5_:Number = NaN;
  19.          var _loc6_:Number = NaN;
  20.          ┬º┬ºpush(param4.x * param2.y);
  21.          ┬º┬ºpush(param2.x * param4.y);
  22.          if(true)
  23.          {
  24.             _loc5_ = ┬º┬ºpop() - ┬º┬ºpop();
  25.             if(Math.abs(_loc5_) < nPrecision)
  26.             {
  27.                return undefined;
  28.             }
  29.             ┬º┬ºpush(param4.y * (param1.x - param3.x) - param4.x * (param1.y - param3.y));
  30.             ┬º┬ºpush(_loc5_);
  31.          }
  32.          _loc6_ = ┬º┬ºpop() / ┬º┬ºpop();
  33.          return new Point(param1.x + _loc6_ * param2.x,param1.y + _loc6_ * param2.y);
  34.       }
  35.       
  36.       public static function SegmentPD(param1:Point, param2:Point, param3:Point, param4:Point) : Point
  37.       {
  38.          var _loc5_:Number = NaN;
  39.          var _loc6_:Number = NaN;
  40.          var _loc7_:Number = NaN;
  41.          var _loc8_:Number = NaN;
  42.          if(true)
  43.          {
  44.             _loc5_ = param4.x * param2.y - param2.x * param4.y;
  45.             if(true)
  46.             {
  47.                if(Math.abs(_loc5_) < nPrecision)
  48.                {
  49.                   if(true)
  50.                   {
  51.                      return undefined;
  52.                   }
  53.                   addr115:
  54.                   ┬º┬ºpush(_loc8_ <= 1);
  55.                }
  56.                else
  57.                {
  58.                   _loc6_ = param2.x * param4.y - param4.x * param2.y;
  59.                   _loc7_ = (param4.y * (param1.x - param3.x) - param4.x * (param1.y - param3.y)) / _loc5_;
  60.                   ┬º┬ºpush((_loc8_ = (param2.x * (param1.y - param3.y) - param2.y * (param1.x - param3.x)) / _loc6_) >= 0);
  61.                   if(true)
  62.                   {
  63.                      if(┬º┬ºpop())
  64.                      {
  65.                         ┬º┬ºpop();
  66.                         ┬º┬ºgoto(addr115);
  67.                      }
  68.                   }
  69.                }
  70.                if(┬º┬ºpop())
  71.                {
  72.                   return new Point(param1.x + _loc7_ * param2.x,param1.y + _loc7_ * param2.y);
  73.                   addr121:
  74.                }
  75.             }
  76.             return undefined;
  77.          }
  78.          ┬º┬ºgoto(addr121);
  79.       }
  80.       
  81.       public function toString() : String
  82.       {
  83.          return _CLASSID_;
  84.       }
  85.       
  86.       public function get _CLASSID_() : String
  87.       {
  88.          return "CLineIntersection";
  89.       }
  90.       
  91.       public function get _BASECLASSID_() : String
  92.       {
  93.          return "CLineIntersection";
  94.       }
  95.    }
  96. }
  97.